<template>
  <div class="home">
    <img alt="Vue logo" src="../assets/logo.png">
<!--    <HelloWorld msg="Welcome to Your Vue.js App"/>-->
<!--    <hi1></hi1>-->
    <inputmy type1="text" :value1="value1" @sonMethod="fatherMethod"></inputmy>
    <h1>下面输出子组件中的数据！</h1>
    mysonValue： {{mysonValue}}
  </div>
</template>

<script>
// @ is an alias to /src
// import HelloWorld from '@/components/HelloWorld.vue'
import son1 from '@/components/son1.vue'

export default {
  name: 'HomeView',
  components: {
    // hi1:HelloWorld
    // 挂子  挂载子组件 设置组件别名为 inputmy
    inputmy:son1
  },
  data() {
    return {
      value1:"123",
      mysonValue:"text",
    }
  },
  methods:{
    //父组件的方法，data是子组件传来的值的形参
    fatherMethod(data){
      console.log(data);
      //修改父组件的data值
      this.mysonValue = data
      console.log("fatherMethod:" + this.mysonValue)
    }
  }
}
</script>
